const baseHost = "http://112.124.30.65";
// const baseHost = "https://api.banpresto-point.com";
const lsUser = JSON.parse(localStorage.getItem("user"));

export async function fetchApi(url, data) {
    const auth = lsUser ? lsUser.loginauth : "";
    // const auth=tmp?"Bearer "+tmp:"";
    return fetch(baseHost + url, {
        method: "POST",
        headers: {
            Authorization: auth,
        },
        body: JSON.stringify(data),
    })
        .then((res) => {
            return res.json();
        })
        .then((res) => {
            return res;
        });
}
